<template>
	<view class="navShop">
		<shop :list="shoplist"></shop>
		<view class="productSearchNull" v-if="shoplist.length == 0">
			<image src="https://www.kmdj2018.com/Uploads/zfb/null.png" mode="aspectFit"></image>
			<view>抱歉，暂无商品</view>
		</view>
	</view>
</template>

<script>
	import shop from "@/components/shop/shop.vue"
	export default {
		data() {
			return {
				list: {},
				shoplist: [],
			};
		},
		components: {
			shop
		},
		onLoad(e) {
			if (e.data) {
				let data = JSON.parse(e.data)
				console.log(data);
				this.list = data
				this.init(data.id)
			}
		},
		onShow() {
			setTimeout(() => {
				uni.setNavigationBarTitle({
					title: this.list.name
				});
			}, 200)
		},
		methods:{
			init(id){
				this.$request("Index/SeachGoods", {
					data: {
						cat_id:id
					},
					isLoad: true
				}).then(res => {
					this.shoplist = res.result
					setTimeout(() => {
						uni.setNavigationBarTitle({
							title: this.list.name
						});
					}, 200)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.navShop {
		padding: 20rpx 32rpx;
	}
	.productSearchNull {
		text-align: center;
		padding-top: 162rpx;
	
		image {
			width: 280rpx;
			height: 180rpx;
		}
	
		view {
			font-size: 28rpx;
			color: #333333;
			margin-top: 40rpx;
		}
	}
</style>
